<include file="public@header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Goods/index')}">商品列表</a></li>
        <li class="active"><a href="{:url('Goods/add')}">添加商品</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Goods/addPost')}">

        <div class="form-group">
            <label for="input-image" class="col-sm-2 control-label">商品图<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="image" >
                <input id="photo-1-name" type="text" name="image" title="图片名称" class="form-control" readonly disabled>
            </div>
        </div>
        <div class="form-group">
            <label for="input-image" class="col-sm-2 control-label"></label>
            <div class="col-md-6 col-sm-10">
                <img id="photo-1-preview" style="width: 100px;">
                <div>
                    <a href="javascript:uploadOneImage('图片上传','#photo-1');" class="btn btn-primary">上传</a>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="booklet" class="col-sm-2 control-label"><span class="form-required">*</span>图册</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="source" name="source">
                <ul id="photos" class="pic-list unstyled"></ul>
                <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-wrapper');" class="btn btn-small">选择图片</a>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">商品名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="name" name="name">
            </div>
        </div>
        <div class="form-group">
            <label for="title" class="col-sm-2 control-label">商品标题</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="title" name="title">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">自营状态</label>
            <div class="col-md-6 col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="zy" value="1" checked> 是
                </label>
                <label class="radio-inline">
                    <input type="radio" name="zy" value="0"> 否
                </label>
            </div>
        </div>
        <div class="form-group">
            <label for="yf" class="col-sm-2 control-label">运费</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="yf" name="yf">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品状态</label>
            <div class="col-md-6 col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="status" value="1" checked> 正常
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="2"> 下架
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="0"> 无货
                </label>
            </div>
        </div>
        <div class="form-group">
            <label for="gid" class="col-sm-2 control-label"><span class="form-required">*</span>分类</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="gid" name="gid">
            </div>
        </div>
        <div class="form-group">
            <label for="input-url" class="col-sm-2 control-label">跳转链接</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-url" name="url">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">添加</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">取消</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    var editorcontent = new baidu.editor.ui.Editor();
    editorcontent.render('content');
</script>
<script type="text/html" id="photos-item-wrapper">
    <li id="savedimage{id}">
        <input id="photo-{id}" type="hidden" name="photos[]" value="{filepath}">
        <input id="photo-{id}-name" type="text"  value="{name}" style="width: 160px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;" onclick="parent.image_preview_dialog(this.src);">
        <a href="javascript:upload_one_image('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#savedimage{id}').remove();})();">移除</a>
    </li>
</script>
</body>
</html>